package com.rfid.dataSync;

import com.rfid.client.LogEvent;
import com.rfid.listener.LogListener;
import com.teatrace.model.TraceInfo;
import com.teatrace.service.RFIDDataSyncService;
import com.teatrace.webservice.client.WebServiceUtils;


public class TraceInfoDataSyncListener implements LogListener {

	private RFIDDataSyncService service;
	
	public TraceInfoDataSyncListener() {
		service = (RFIDDataSyncService) WebServiceUtils.getService("rfidDataSync");
	}
	
	@Override
	public void onLogEvent(LogEvent e) {
		TraceInfo info = new TraceInfo();
		info.setAddress(e.getAddress());
		info.setDescription(e.getDescription());
		info.setNumber(e.getNumber());
		info.setRecordTime(e.getRecordTime());
		service.syncTraceInfo(info, e.getProductNum());
	}

}
